LogOffServer Method (Database Object)
The LogOffServer method logs off an SQL server, ODBC or other data source. Use this method when you have logged on to the data source using LogOnServer. This method can be invoked only in formatting Idle mode.
Syntax
Sub LogOffServer (pDllName As String, pServerName As String,
[pDatabaseName], [pUserID], [pPassword])
Parameters
Parameter
| Description
|
pDllName
| Specifies the name of the DLL for the server or password protected non-SQL table you want to log on to, for example "PDSODBC.DLL". Note that the dllName must be enclosed in quotes. DLL names have the following naming convention: PDB*.DLL for standard (non-SQL) databases, PDS*.DLL for SQL/ODBC databases.
|
pServerName
| Specifies the log on name for the server used to create the report. For ODBC, use the data source name. This value is case-sensitive. See Remarks below.
|
[pDatabaseName]
| Specifies the name for the database used to create the report. See Remarks below.
|
[pUserID]
| Specifies the User ID number necessary to log on to the server. See Remarks below.
|
[pPassword]
| Specifies the password necessary to log on to the server.
|
Remarks
- When you pass an empty string ("") for pServerName, pDatabaseName, or pUserID, the program uses the value that's already set in the report. If you want to override a value that's already set in the report, use a non-empty string (for example, "Server A").
- If you try to log off a server that is still in use (that is, there is an object variable still in focus that holds reference to a report that requires being logged on to the server to access data) you will be unable to log off. This will apply to every object that comes from the Report Object, as they all hold reference to the report through their respective Report properties.
- If you assign the Report object to the ReportSource property of the CRViewer Object (CRVIEWERLib), in the Crystal Reports Report Viewer, enabling the report to be displayed through the Report Viewer, you cannot call LogOffServer for the report until you assign a new report to the Report Viewer or close the CRViewer object.